/**
 * @author		Ben Layet
 * @version 	1.0
 * @date		25 Sep 2008
 */
package org.ignoramus.application.model;

import org.ignoramus.application.model.AnswerCheckers.AnswerChecker;

/**
 * Element of a card template.
 */
public class CardTemplateElement
{
	/** The type of field for the question. */
	private final String questionTypeName;
	/** The name of the checker. */
	private final String checkerName;
	/** The name of the element. */
	private final String name;
	/** The source information of the element. */
	private final String source;
	
	/**
	 * Sole constructor.
	 * @param checkerName The name of the checker.
	 * @param name The name of the element.
	 * @param questionTypeName The type of field for the question.
	 * @param source The source information of the element. 
	 */
	public CardTemplateElement(String checkerName, String name, String questionTypeName, String source)
	{
		this.checkerName = checkerName;
		this.name = name;
		this.questionTypeName = questionTypeName;
		this.source = source;
	}
	/**
	 * @return The type of field for the question.
	 */
	public QuestionFieldType getQuestionFieldType()
	{
		return QuestionFieldType.valueOf(questionTypeName.toUpperCase());
	}
	/**
	 * @return the source
	 */
	public String getSource()
	{
		return source;
	}
	/**
	 * @return the checker
	 */
	public AnswerChecker getChecker()
	{
		return AnswerCheckers.getChecker(checkerName);
	}
	/**
	 * @return the name
	 */
	public String getName()
	{
		return name;
	}
	
}
